/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-08
 * Time: 22:02
 */

abstract class Animal {
    public String name;
    public Animal(String name) {
        this.name = name;
    }
    public abstract void eat();
}
interface fly{
    void flying();
}
interface run{
    void running();
}

interface swim{
    void swimming();
}

class Cat extends Animal implements fly,swim,run{
    public Cat(String name) {
        super(name);
    }
    @Override
    public void eat() {
        System.out.println(this.name+"吃猫粮！！");
    }

    @Override
    public void flying() {
        System.out.println(this.name+"正在飞向远方~~~~");
    }

    @Override
    public void running() {
        System.out.println(this.name+"正在抓老鼠！！！");
    }

    @Override
    public void swimming() {
        System.out.println(this.name+"正在游泳~~~~~");
    }
}

class Duck extends Animal implements fly,swim{
    public Duck(String name) {
        super(name);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"吃鸭粮！！");
    }


    @Override
    public void flying() {
        System.out.println(this.name+"正在飞向远方~~~~");
    }

    @Override
    public void swimming() {
        System.out.println(this.name+"正在游泳~~~~~");
    }
}


public class TestDemo {

    public static void action1(fly fly1,swim swim1,run run1) {
        fly1.flying();
        swim1.swimming();
        run1.running();
    }
    public static void action2(fly fly1,swim swim1) {
        fly1.flying();
        swim1.swimming();
    }
    public static void main(String[] args) {
        Cat cat = new Cat("咪咪");
        Duck duck = new Duck("嘎嘎");
        action1(cat,cat,cat);
        action2(duck,duck);
    }

}
